<div class="wrap">

{if $resp_message == null}
	<div id="ajaxResponse" class="ajaxResponse"></div>
{else}
	<div id="ajaxResponse" class="ajaxResponse fade" style="display:block">{$resp_message}</div>
{/if}
<h2>Benutzerverwaltung</h2>
	<form name="adduser" id="adduser" method="post" action="?{$smarty.server.QUERY_STRING}"
	onsubmit="onAddUser('adduser', 'ajaxResponse', 'thelist','user_id','../view/admin/images/object_delete.png','?{$smarty.server.QUERY_STRING}'); return false;">
	<input type="hidden" name="act" value="adduser" />
	<table class="editform" width="50%" align="center" cellpadding="5">
		<tr>
			<th width="33%" scope="row" valign="top">
				User Receiver email :
            </th>
			<td width="67%">
			<select name="user_id" id="user_id">
            	{foreach name=country from=$ALLEMAIL.user item=item}
                    <option id='{$item->user_id}' value='{$item->user_id}'>
                    {$item->user_name} ({$item->user_email})
                    </option>
                {/foreach}
            </select>
            </td>
		</tr>
	</table>
    <p class="submit" align = "right">
		<input type="image" name="submit" src="../view/admin/images/object_save.png" value="" />
	</p>
</form>
	<table class="widefat">
		<thead>
		<tr>
			<th class="point {if $smarty.get.by eq 'desc'}sortover{else}sortoverup{/if}"  scope="col" onclick="javascript:document.location='?module={$smarty.get.module}{if $smarty.get.sub1}&sub1={$smarty.get.sub1}{/if}&sort=user_id&by={if $smarty.get.by eq 'desc'}asc {else}desc{/if}'">{TranslateTag}B_LABEL_ID{/TranslateTag}</th>
			<th class="point {if $smarty.get.by eq 'desc'}sortover{else}sortoverup{/if}"  scope="col" onclick="javascript:document.location='?module={$smarty.get.module}{if $smarty.get.sub1}&sub1={$smarty.get.sub1}{/if}&sort=user_name&by={if $smarty.get.by eq 'desc'}asc {else}desc{/if}'">{TranslateTag}B_LABEL_USERNAME{/TranslateTag}</th>
			<th class="point {if $smarty.get.by eq 'desc'}sortover{else}sortoverup{/if}"  scope="col" onclick="javascript:document.location='?module={$smarty.get.module}{if $smarty.get.sub1}&sub1={$smarty.get.sub1}{/if}&sort=user_email&by={if $smarty.get.by eq 'desc'}asc {else}desc{/if}'">{TranslateTag}B_LABEL_EMAIL{/TranslateTag}</th>
			<th class="point {if $smarty.get.by eq 'desc'}sortover{else}sortoverup{/if}"  scope="col" onclick="javascript:document.location='?module={$smarty.get.module}{if $smarty.get.sub1}&sub1={$smarty.get.sub1}{/if}&sort=is_admin&by={if $smarty.get.by eq 'desc'}asc {else}desc{/if}'">{TranslateTag}B_LABEL_ADMINISTRATOR{/TranslateTag}</th>
	        {if $smarty.session.user_isadmin == "1"}
	        <th colspan="2" style="text-align: center">Aktionen</th>
	        {/if}
		</tr>
		</thead>
		<tbody id="thelist">
			{foreach name=user from=$ALLEMAIL.allemail item=item}
				<tr id="user_{$item->user_id}">
					<th scope='row' style='text-align: left'>{$item->user_id}</th>
					<td align='left'>{$item->user_name}</td>
					<td align='left'>{$item->user_email}</td>
					<td align='left'>{if $item->is_admin == "1"}X{/if}</td>
					{if $smarty.session.user_isadmin == "1"}
                    <td><a onclick="onDeleteEmail('?{$smarty.server.QUERY_STRING}', '{$item->id}', 'ajaxResponse','user_id','{$item->user_id}')" class='delete'>
                        <img src="../view/admin/images/object_delete.png" alt="Delete" />
                        </a>
                    </td>
					{/if}
				</tr>
			{/foreach}
		</tbody>
	</table>
</div>
